<%@page import="me.yobol.blog.commons.LoginStatus"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>

<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/header.css"/>
<div id="header" class="fixed">
	<div class="w_1280 h_58 relative">
		<!-- logo begin -->
		<%-- 图片宽度为110px * 40px --%>
		<div id="logo">
			<a href="<%= request.getContextPath() %>/index.jsp">
				<img alt="Yobol" src="<%= request.getContextPath() %>/res/imgs/yobol_logo.png" />
			</a>
		</div>
		<!-- logo end -->
		
		<!-- nav begin -->
		<div id="nav">
			<ul class="h_58">
				<li><a href="<%= request.getContextPath() %>/index.jsp">首页</a></li>
				<li><a href="<%= request.getContextPath() %>/pages/java.jsp">Java</a></li>
				<li><a href="<%= request.getContextPath() %>/pages/mysql.jsp">MySQL</a></li>
			</ul>
		</div>
		<!-- nav end -->
		
		<!-- icon box begin -->
		<div id="icon_box">
			<!-- 搜索框 -->
			<span class="icon search" onclick="showSearchBox();"> </span>

			<!-- pc为personal center缩写,即个人中心 -->
			<span class="icon pc relative" onmouseover="showPcSubmenu();" onmouseout="hidePcSubmenu();"> 
				<!-- pc_submenu_top是上面个人中心标签上面的那个三角 -->
				<i id="pc_submenu_top" class="submenu_top absolute"></i>
				<dl id="pc_submenu" class="submenu absolute">
					<dd>
						<%
							int loginStatus = -1;
							Object obj = session.getAttribute("LoginStatus");
							if(obj != null){
								loginStatus = (Integer)obj;
							}
							if (loginStatus == LoginStatus.USER) {
						%>
							<!-- 在这里获取用户名不能使用request.getParameter("uName")，不然当点击超链接重定向到首页时，就获取不到正确的用户名了 -->
							<p id="welcome_slogan">欢迎,<%=request.getSession().getAttribute("Name") %></p>
						<%
							} else {
						%>
								<a href="<%=request.getContextPath()%>/pages/register.jsp" class="pc_first">注册</a>
								<span class="sep">|</span>
								<a href="<%=request.getContextPath()%>/pages/login.jsp" class="pc_first">登录</a>
						<%
							}
						%>
							</dd>
							<dd>
								<i class="grzx relative"></i>
								<a href="<%=request.getContextPath()%>/pages/login.jsp" class="pc_no_frist">个人中心</a>
							</dd>
						<%
							if (loginStatus == LoginStatus.USER) {
						%>
								<dd>
									<i class="exit relative"></i>
									<a href="<%=request.getContextPath()%>/LoginOutServlet" class="pc_no_frist">退出登录</a>
								</dd>
						<%
							}
						%>
				</dl>
			</span>
		</div>
		<!-- icon-box end -->
		<!-- search box begin -->
		<form action="<%=request.getContextPath()%>/SearchServlet" method="post" id="search_box" class="search_box relative">
			<div id="search_box_left" class="search_box_left show_search_box_left">
				<input type="submit" id="search_icon" class="search_icon" value="" />
				<input type="text" id="search_bar" class="search_bar" placeholder="搜索" name="searchkey"/>
			</div> 
			<i id="close_icon" class="close_icon anti_rotate_close_icon absolute" onclick="clickCloseIcon();"></i>
		</form>
		<!-- search box end -->
	</div>
	</div>
	<script type="text/javascript" src="<%=request.getContextPath()%>/jQuery/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/js/header.js"></script>
</div>
